<?php
	session_start();
?>

<?php
    include("include/database.php");
	include("include/configuration.php");
    include("pagination/ps_pagination.php");
    $obj_config = new Config();
	$db = new database();
    include_once("process/admin.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link href="css/global.css" rel="stylesheet" type="text/css" />

    <script src="js/DD_roundies_0.0.2a.js" type="text/javascript"></script>
    <script src="js/IncludeScript.js" type="text/javascript"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
    <title>Admin</title>
</head>
<body>
<?php
	if($_POST["action"] == "login")
	{	
	   $admin = new admin();
		$user = $_POST["user"];
		$pass = $_POST["pass"];
        
       // echo $user, $pass;
        $list = $admin->GetListAdmin($user, $pass);
        //echo count($list);
		if(count($list)>0)
		{
			$_SESSION["admin"] = $user;
			echo "<meta http-equiv='refresh' content='0; url=index.php' />";
		}
        else
        {
            echo "Username or Password is invalid.";
        }
	}
?>
<script type="text/javascript">
	function link()
	{
		//document.search.action="login";
		document.search.submit();
	}
</script>
<center>
	<div style="height:170px;"></div>
	<form style="margin: 0px; padding: 0px;" id="search" name="search" method="post" action="">
		<table width="170px" border="0">
			<tr>
				<td height="40px" colspan="2" align="center"><img width="14" src="asset/icon_login.png"></td>
			</tr>
			<tr>
				<td>User:</td><td><input type="text" name="user" size="14"></td>
			</tr>
			<tr>
				<td>Pass:</td><td><input type="password" name="pass" size="14"></td>
			</tr>
			<tr>
				<td colspan="2" align="center" style="padding-top:10px;">
					<input type="button" value="" style="width:57px; height:18px; display:block; background:url(asset/btnlogin.gif); border:0; margin-top:2px;" name="login" onClick="link();"  >					
					<input type="hidden" name="action" value="login" />
				</td>
			</tr>
		</table>
	</form>
</center>
</body>
</html>